/*ParallelPlatform Project - A web platform to distribute and share knowledge
Copyright (C) 2011  Daniel Guerrero Martinez & Sergio Rodriguez Lumley

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.*/
/*
 * This document has been created to control all functionallity of themes and pages
 * 
 * @author Daniel Guerrero Martinez
 * @author Sergio Rodriguez Lumley
 * 
 * @requires jQuery v1.3.2 or later previously imported
 * 
 * Licensed under GPLv3 license, check
 * 		http://www.gnu.org/licenses/gpl.html
 * for more information
 */

$(document).ready( function(){
	$("div.login, div.theme, div.language").css("display", "none");
	
	$("span.login, span.theme, span.language").click(divHidder);
	
});

/**
 * Catches the click event to hide or show the clicked panel,
 *  hidding the rest if necessary. It is assumed that these panels
 *	are Theme, Login or Language panels
 */
function divHidder (evt) {
	//$(this) 	Elemento JQuery
	// this		Elemento del DOM
	var div		= "div."+$(this).attr("class");
	var disp 	= $(div).css("display");
	if(disp == "none"){
		$("div.login, div.theme, div.language").fadeOut('fast');
		$(div).fadeIn('fast');
		$(div).find("input[name=username]").focus();
	}else{
		$(div).fadeOut('fast');
	}
}
